Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 3 - Image Compression Manager / Using the Image Compression Manager


Working With Pictures

The Image Compression Manager provides a set of functions that allow applications to work easily with compressed pictures stored in version 2 PICT files. These functions constitute a high-level interface to image compression and decompression. Applications that require little control over the compression process may use these functions to display pictures that contain compressed image data.

Existing programs can display (without changes) pictures that contain compressed image data. When the Image Compression Manager is installed on a system, it installs a new StdPix graphics function (see page 3-141 for more information on the StdPix graphics function). This function handles all requests to display compressed images. Whenever an application issues the standard QuickDraw DrawPicture routine (described in Inside Macintosh: Imaging) to display an image that contains compressed image data, the StdPix function decompresses the image by invoking the Image Compression Manager. The function then delivers the decompressed image to the application.

The Image Compression Manager also provides a simple mechanism for creating a picture that contains compressed image data. For example, to place an existing compressed image into a picture, your application could open the picture with QuickDraw's OpenPicture (or OpenCPicture) function and then call the Image Compression Manager's DecompressImage function, as if you were going to display the image. The Image Compression Manager places the compressed image and the other data that describe the image into the picture for you.

The Image Compression Manager stores the following information about a compressed picture:

The Image Compression Manager stores this information in the picture as a new PICT opcode (described in the following paragraphs). When an application draws the compressed picture on a Macintosh computer that is running the Image Compression Manager, the StdPix function instructs the Image Compression Manager to decompress the image. If an application tries to read a picture file that contains compressed data on a Macintosh that does not have the Image Compression Manager installed, the system ignores the new opcodes and displays a message that indicates that the user
needs QuickTime in order to display the compressed image data. The message states "QuickTime and a <Codec Name> decompressor are needed to see this picture".

The Color QuickDraw version 2 picture format includes PICT opcodes for compressed and uncompressed QuickTime images. (An opcode is a hexidecimal number that represents drawing commands and the parameters that affect those drawing commands in a picture.) For more information on the version 2 picture format, see the chapter "Color QuickDraw" in Inside Macintosh: Imaging.

The PICT opcodes for compressed and uncompressed QuickTime images are

Table 3-1 gives an overview of the opcode for QuickTime compressed pictures.
Table 3-1 Fields of the PICT opcode for compressed QuickTime images
Field nameDescriptionData size (in bytes)
OpcodeCompressed picture data2
SizeSize in bytes of data for this opcode4
VersionVersion of this opcode2
Matrix3 by 3 fixed transformation matrix36
MatteSizeSize of matte data in bytes4
MatteRectRectangle for matte data8
ModeTransfer mode2
SrcRectRectangle for source8
AccuracyPreferred accuracy4
MaskSizeSize of mask region in bytes4

WARNING
Do not attempt to read opcodes directly. For compatibility reasons, use Toolbox routines to access this information.
The MaskSize field of opcode $8200 is followed by five variable fields:

See "The Image Description Structure" beginning on page 3-43 for details on the idSize and dataSize fields.

Table 3-2 provides an overview of the structure of uncompressed QuickTime images.
Table 3-2 Fields of the PICT opcode for uncompressed QuickTime images
Field nameDescriptionData size (in bytes)
OpcodeUncompressed picture data2
SizeSize in bytes of data for this opcode4
VersionVersion of this opcode2
Matrix3 by 3 fixed transformation matrix36
MatteSizeSize of matte data in bytes4
MatteRectRectangle for matte data8

The MatteRect field of opcode $8201 is followed by three variable fields and a subopcode:


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996